package com.exwave.socialgame.model_wolfgame.wolfdata;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
@ApiModel("Record 事件记录类")
public class Record {
    @ApiModelProperty("记录每局游戏身份")
    HashMap<Integer, Player> users;//记录每局游戏的身份情况，key为位置编号，默认12个位置；
    @ApiModelProperty("每局游戏夜晚记录")
    List<List<Event>> nightEvents;//一局游戏的记录，元素为每一天的记录，分为白天与黑夜，index为天数
    //List对应天数，多个Event集合构成一天
    @ApiModelProperty("每局游戏白天记录")
    List<List<Event>> dayEvents;
    @ApiModelProperty("当前游戏天数")
    int day;//天数

    public Record() {
        this.day = 0;
        this.dayEvents = new ArrayList<>();
        this.nightEvents = new ArrayList<>();
        List<Event> events = new ArrayList<>();
        dayEvents.add(events);
        nightEvents.add(events);
        /*白天晚上分别添加了空事件集，后面可以直接get(0)获取*/
    }

    public void addNightEvent(int day, Event event) {
        if (this.day < day) {
            this.day = day;
            List<Event> eventList = new ArrayList<>();
            this.nightEvents.add(eventList);
        }
        this.nightEvents.get(day - 1).add(event);
    }

    public void addDayEvent(int day, Event event) {
        if (this.day < day) {
            this.day = day;
            List<Event> eventList = new ArrayList<>();
            this.dayEvents.add(eventList);
        }
        dayEvents.get(day - 1).add(event);
    }

    //获取某一白天的操作记录
    public List<Event> getDayEvents(int day) {
        return this.dayEvents.get(day - 1);
    }

    //获取某一夜晚的操作记录
    public List<Event> getNightEvents(int day) {
        return this.nightEvents.get(day - 1);
    }


}
